# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: astaroth <astaroth_@web.de>

pkgname=jad
pkgver=1.5.8e
pkgrel=11
pkgdesc='Java decompiler'
license=(custom)
arch=(loong64 x86_64)
url='https://varaneckas.com/jad'
optdepends=('vim-jad: open class files directly in vim and see the decompiled source code')
source=("https://varaneckas.com/$pkgname/${pkgname}${pkgver//./}.linux.static.zip"
        'license.html::https://varaneckas.com/jad')
b2sums=('1bb59583fee60a805b47ea7fa0cb14090912719ea827453447777873c7c17dadb39b17938207dd56ef6f2ccf0fbaed7bbf953b68b9bd66c3f8694cf771bd423e'
        '4195dc5a26a18d938490dcc1343dfbba934b0bb333eedd0df45b62c0e4c988a25e7d85d45e418c64fa5643dfa9a97f33a178a4d57fc37f1bf5f85db8a192790a')

prepare() {
  grep '<blockquote>' -A18 license.html | cut -d'>' -f2 | cut -d'<' -f1 > LICENSE
}

package() {
  install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm644 Readme.txt "$pkgdir/usr/share/doc/$pkgname/README"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
